package com.demo.mapper;

import com.demo.entity.Video;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface VideoMapper {
    @Select("select video_id videoId,video_title videoTitle from video")
    List<Video> selectAllvideos();

    @Select("select video_id videoId,video_title videoTitle from video where video_id=#{id}")
    Video selectVideoById(int id);

    @Delete("delete from video where video_id=#{id}")
    int deleteVideoById(int id);

    @Insert("insert into video (video_title) values (#{videoTitle})")
    int insertVideo(Video video);

    @Update("update video set video_title = #{videoTitle} where video_id = #{videoId}")
    int updateVideo(Video video);

}
